﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Plot.Primitives
{
    internal class AxisArrow : PShape
    {
        public double ArrowLength { get; set; }
        public double ArrowWidth { get; set; }

        public AxisArrow(double x, double y, double length, double width, double angle)
            : base(x, y, angle)
        {
            ArrowLength = length;
            ArrowWidth = width;
            Angle = angle;
        }

        public override IEnumerator<PShape> GetEnumerator()
        {
            return new ReadOnlyCollection<PShape>(new[] { 
                                                            new PLine(StartPoint.X - ArrowLength, StartPoint.Y + ArrowWidth/2, StartPoint.X, StartPoint.Y) {PivotPoint = PivotPoint, Angle = Angle},
                                                            new PLine(StartPoint.X, StartPoint.Y, StartPoint.X - ArrowLength, StartPoint.Y - ArrowWidth/2) {PivotPoint = PivotPoint, Angle = Angle}}).
                GetEnumerator();
        }
    }
}